﻿<html>
    <head>
        <script type="text/javascript" language="javascript">
            /*
            ***************************
            Definicao do objecto filter
            ***************************
            filter = new Object
            filter.Equipa.name = "Benfica"
            filter.Equipa.type = "EquipaAtacante"
            filter.Equipa.Jogadores[0].name = "Aimar"
            filter.Equipa.Jogadores[0].isLeftFoot = false
            filter.Equipa.Jogadores[0].event = new Object
            filter.Equipa.Jogadores[0].event.Corte = "Cabeca"
            */
        
        
            var g_idxArrayFilters = 0;
            var g_arrayFilters = new Array();
            var g_currentFilter;
            
            function init(){
               try{
                  g_currentFilter = new Object();

                  document.getElementById("viewFilterDiv").style.display = 'none';
                  
                  document.getElementById("buttonCancelMatchInfo").disabled=true;
                  document.getElementById("buttonAddPlayerEventFilter").disabled = true;
                  document.getElementById("buttonAddFilters").disabled = true;
                  document.getElementById("buttonSubmit").disabled = true;
                  
                  document.getElementById("Team1Name").disabled=false;
                  document.getElementById("Team1Type").disabled=false;
                  document.getElementById("Team2Name").disabled=false;
                  document.getElementById("Team2Type").disabled=false;
                  document.getElementById("BallPlace").disabled=false;
                  document.getElementById("buttonSaveMatchInfo").disabled=false;
                  document.getElementById("buttonCancelMatchInfo").disabled=true;

                  document.getElementById("playersList").innerHTML = "";
                  
                  showHidePlayerEventFilters(false);
               }
               catch(err){
                  alert("init: " + err.description);
               }
            }
            
            /*************************/
            /*** Show/hide filters ***/
            /*************************/
            function showHidePlayerEventFilters(show){
               try{
                  if(show){
                     document.getElementById("divPlayerEventFilter").style.display = '';
                  }
                  else{
                     document.getElementById("divPlayerEventFilter").style.display = 'none';
                     document.getElementById("divPlayerWithEventFilter").style.display = 'none';
                  }
               }
               catch(err){
                  alert("showHidePlayerEventFilters: " + err.description);
               }
            }
            
            function showHidePlayerWithEvent(){
               try{
                  if(document.getElementById("cbPlayerWithEvent").checked){
                     document.getElementById("divPlayerWithEventFilter").style.display = '';
                  }
                  else{
                     document.getElementById("divPlayerWithEventFilter").style.display = 'none';
                  }
               }
               catch(err){
                  alert("fillHiddenInputs: " + err.description);
               }
            }
            
            function showPlayerEventFilters(){
               try{
                  document.getElementById("buttonAddPlayerEventFilter").disabled = true;
                  showHidePlayerEventFilters(true);
               }
               catch(err){
                  alert("showPlayerEventFilters: " + err.description);
               }
            }
            
            /*************************************/
            /*** Save match/teams information  ***/
            /*************************************/
            
            function saveMatchInfo(){
               try{
                  g_currentFilter.Equipa1 = new Object();
                  g_currentFilter.Equipa2 = new Object();
                  g_currentFilter.Equipa1.name = "";
                  g_currentFilter.Equipa1.type = "";
                  g_currentFilter.Equipa2.name = "";
                  g_currentFilter.Equipa2.type = "";
                  
                  g_currentFilter.Location = document.getElementById("BallPlace").value;
                  
                  if(document.getElementById("Team1Name").value != ""){
                     g_currentFilter.Equipa1.name = document.getElementById("Team1Name").value;
                     g_currentFilter.Equipa1.type = document.getElementById("Team1Type").value;
                  }
                  
                  if(document.getElementById("Team2Name").value != ""){
                     g_currentFilter.Equipa2.name = document.getElementById("Team2Name").value;
                     g_currentFilter.Equipa2.type = document.getElementById("Team2Type").value;
                  }
                  
                  lockMatchFilters();
                  addTeamInfoToPlayerEventFilters();
               }
               catch(err){
                  alert("saveTeamInfo: " + err.description);
               }
            }
            
            function addTeamInfoToPlayerEventFilters(){
               try{
                  var equipa1 = document.getElementById("Team1Name").value;
                  var equipa2 = document.getElementById("Team2Name").value;
                  document.getElementById("PlayersTeam").innerHTML = "";
                  
                  if(equipa1 == undefined || equipa1 == "" || equipa2 == undefined || equipa2 == ""){
                     document.getElementById("PlayersTeam").innerHTML += "<option value=''>Nada</option>";
                  }

                  if(equipa1 != "" && equipa1 != undefined){
                     document.getElementById("PlayersTeam").innerHTML += "<option value='" + equipa1 + "'>" + equipa1 + "</option>";
                  }
                  if(equipa2 != "" && equipa2 != undefined){
                     document.getElementById("PlayersTeam").innerHTML += "<option value='" + equipa2 + "'>" + equipa2 + "</option>";
                  }
               }
               catch(err){
                  alert("addTeamInfoToPlayerEventFilters: " + err.description);
               }
            }
            
            function lockMatchFilters(){
               try{
                  document.getElementById("Team1Name").disabled=true;
                  document.getElementById("Team1Type").disabled=true;
                  document.getElementById("Team2Name").disabled=true;
                  document.getElementById("Team2Type").disabled=true;
                  document.getElementById("BallPlace").disabled=true;
                  document.getElementById("buttonSaveMatchInfo").disabled=true;
                  document.getElementById("buttonCancelMatchInfo").disabled=false;
                  document.getElementById("buttonAddPlayerEventFilter").disabled = false;
                  document.getElementById("buttonAddFilters").disabled = false;
               }
               catch(err){
                  alert("lockMatchFilters: " + err.description);
               }
            }
            
            /****************************************/
            /*** Validate information  ***/
            /****************************************/
            function validateAddPlayerEvent(){
               try{
                  var arrFieldsPlayerEvent = [
                                             "PlayersName",
                                             "Tackle",
                                             "SetPieces",
                                             "Fault",
                                             "Shooting",
                                             "EventPlace"
                                             ];

                  return !isEmpty(arrFieldsPlayerEvent) || 
                           document.getElementById("cbCelebration").checked ||
                           document.getElementById("cbGoal").checked;
               }
               catch(err){
                  alert("validatePlayerEventsFilters: " + err.description);
               }
            }
            
            function validateAddFilter(){
               try{
                  if((g_currentFilter.Equipa2.name == "" || g_currentFilter.Equipa2.name == undefined) &&
                     g_currentFilter.Equipa2.players == undefined &&
                     (g_currentFilter.Equipa1.name == "" || g_currentFilter.Equipa1.name == undefined) &&
                     g_currentFilter.Equipa1.players == undefined){
                     return false;   
                  }
                  
                  return true;
               }
               catch(err){
                  alert("validateAddFilter: " + err.description);
               }
            }
            
            function validateSubmitFilters(){
               try{
                  return g_arrayFilters != undefined && g_arrayFilters.length > 0;
               }
               catch(err){
                  alert("validateSubmitFilters: " + err.description);
               }
            }
            
            function isEmpty(arrFields){
               try{
                  for(var i = 0; i < arrFields.length; ++i){
                     if(document.getElementById(arrFields[i]).value != "" && 
                        document.getElementById(arrFields[i]).value != undefined){
                        return false;
                     }
                  }
                  
                  return true;
               }
               catch(err){
                  alert("isEmpty: " + err.description);
               }
            }
            
            /****************************************/
            /*** Save players/events information  ***/
            /****************************************/
            
            function addPlayerEventInfo(){
               try{
                  if(!validateAddPlayerEvent()){
                     alert("Não existe informação suficiente para adicionar um filtro de jogador.");
                     return;
                  }
               
                  var name = document.getElementById("PlayersName").value;
                  
                  var objPlayer = new Object();
                  objPlayer.name = name;
                  objPlayer.isLeftFoot = document.getElementById("cbPlayerLeftFoot").checked;
                  
                  var listElementPlayer = (name != "" && name != undefined) ? name : "Ocorrencia";
                  var team = document.getElementById("PlayersTeam").value;
                  if(team != "" && team != undefined){
                     listElementPlayer += " - " + team;
                  }
                  document.getElementById("playersList").innerHTML += "<li>" + listElementPlayer + "</li>";

                  var hasEvent = document.getElementById("cbPlayerWithEvent").checked;
                  if(hasEvent){
                     objPlayer.event = getPlayerEvents();
                  }
                  addPlayerToTeam(team, objPlayer);
                  
                  clearPlayerFilters();
                  clearEventFilters();
               }
               catch(err){
                  alert("addPlayerEventInfo: " + err.description);
               }
            }

            function getPlayerEvents(){
               try{
                  var event = new Object();
                  
                  event.celebration = document.getElementById("cbCelebration").checked;
                  event.goal = document.getElementById("cbGoal").checked;
                  event.tackle = document.getElementById("Tackle").value;
                  event.setPieces = document.getElementById("SetPieces").value;
                  event.fault = document.getElementById("Fault").value;
                  event.shooting = document.getElementById("Shooting").value;
                  event.place = document.getElementById("EventPlace").value;
                  
                  return event;
               }
               catch(err){
                  alert("getPlayerEvents: " + err.description);
               }
            }
            
            function addPlayerToTeam(strTeamName, objPlayer){
               try{
                  if(g_currentFilter.Equipa1.name == strTeamName){
                     if(g_currentFilter.Equipa1.players == undefined){
                        g_currentFilter.Equipa1.players = new Array();
                        g_currentFilter.Equipa1.players[0] = objPlayer;
                     }
                     else{
                        g_currentFilter.Equipa1.players[g_currentFilter.Equipa1.players.length] = objPlayer;
                     }
                  }
                  else{
                     if(g_currentFilter.Equipa2.name == strTeamName){
                        if(g_currentFilter.Equipa2.players == undefined){
                           g_currentFilter.Equipa2.players = new Array();
                           g_currentFilter.Equipa2.players[0] = objPlayer;
                        }
                        else{
                           g_currentFilter.Equipa2.players[g_currentFilter.Equipa2.players.length] = objPlayer;
                        }
                     }
                  }
               }
               catch(err){
                  alert("addPlayerToTeam: " + err.description);
               }
            }
            
            /***********************************/
            /***       Cancel Filters        ***/
            /***********************************/
            function cancelMatchInfo(){
               try{
                  clearAllFilters();
                  init();
               }
               catch(err){
                  alert("cancelMatchInfo: " + err.description);
               }
            }
            
            /********************************/
            /*** Save filter information  ***/
            /********************************/
            function addFilters(){
               try{
                  if(validateAddFilter()){
                     g_arrayFilters[g_idxArrayFilters++] = g_currentFilter;
                     clearAllFilters();
                     init();
                     document.getElementById("buttonSubmit").disabled = false;
                  }
                  else{
                     alert("Não existe informação suficiente para criar um filtro.");
                  }
               }
               catch(err){
                  alert("addFilters: " + err.description);
               }
            }
            
            /****************************/
            /*** Clear filters fields ***/
            /****************************/
            function clearAllFilters(){
               try{
                  clearMatchFilters();
                  clearPlayerFilters();
                  clearEventFilters();
               }
               catch(err){
                  alert("clearFilters: " + err.description);
               }
            }
            
            function clearMatchFilters(){
               try{
                  document.getElementById("Team1Name").value = "";
                  document.getElementById("Team1Type").value = "";
                  document.getElementById("Team2Name").value = "";
                  document.getElementById("Team2Type").value = "";
                  document.getElementById("BallPlace").value = "";
               }
               catch(err){
                  alert("clearMatchFilters: " + err.description);
               }
            }
            
            function clearPlayerFilters(){
               try{
                  document.getElementById("PlayersName").value = "";
                  document.getElementById("PlayersTeam").value = "";
                  document.getElementById("cbPlayerLeftFoot").checked = false;
               }
               catch(err){
                  alert("clearPlayerFilters: " + err.description);
               }
            }
            
            function clearEventFilters(){
               try{
                  document.getElementById("cbPlayerWithEvent").checked = false;
                  document.getElementById("cbCelebration").checked = false;
                  document.getElementById("cbGoal").checked = false;
                  document.getElementById("Tackle").value = "";
                  document.getElementById("SetPieces").value = "";
                  document.getElementById("Fault").value = "";
                  document.getElementById("Shooting").value = "";
                  document.getElementById("EventPlace").value = "";
                  showHidePlayerWithEvent();
               }
               catch(err){
                  alert("clearPlayerFilters: " + err.description);
               }
            }
            
            function clearPlayersList(){
               try{
                  document.getElementById("playersList").innerHTML = "";
                  g_currentFilter.Equipa2.players = undefined;
                  g_currentFilter.Equipa1.players = undefined;
               }
               catch(err){
                  alert("clearPlayersList: " + err.description);
               }
            }
            
            /***********************************/
            /***       Submit Filters        ***/
            /***********************************/
            function submitForm(){
               try{
                  if(validateSubmitFilters()){
                     document.getElementById("inputFilters").value = generateFiltersString();
                     document.forms["form1"].submit();
                  }
                  else{
                     alert("Não existem filtros definidos");
                  }
               }
               catch(err){
                  alert("submitForm: " + err.description);
               }
            }
            
            function generateFiltersString(){
               try{
                  var strAllFilters = "[";
                  
                  for(var i = 0; i < g_arrayFilters.length; ++i){
                     strAllFilters += "{";
                     strAllFilters += "'bolaEsta': '" + g_arrayFilters[i].Location + "',";
                     strAllFilters += "'equipa1':{'nome': '" + g_arrayFilters[i].Equipa1.name + "','tipo': '" + g_arrayFilters[i].Equipa1.type + "'";

                     if(g_arrayFilters[i].Equipa1.players != undefined){
                        strAllFilters += ",'jogadores': [";
                        
                        for(var j = 0; j < g_arrayFilters[i].Equipa1.players.length; ++j){
                           player = g_arrayFilters[i].Equipa1.players[j];
                           strAllFilters += "{'nome': '" + player.name + "', 'eCanhoto': '" + player.isLeftFoot +"'";
                           if(player.event != undefined){
                              strAllFilters += ", 'ocorrencias': [{";
                              strAllFilters += "'festeja': '" + player.event.celebration + "',";
                              strAllFilters += "'golo': '" + player.event.goal + "',";
                              strAllFilters += "'fazCorte': '" + player.event.tackle + "',";
                              strAllFilters += "'bolaParada': '" + player.event.setPieces + "',";
                              strAllFilters += "'fazFalta': '" + player.event.fault + "',";
                              strAllFilters += "'remate': '" + player.event.shooting + "',";
                              strAllFilters += "'local': '" + player.event.place + "'";
                              strAllFilters += "}]";
                           }
                           strAllFilters += "}"; //fechar 1 jogador
                           if(j != (g_arrayFilters[i].Equipa1.players.length - 1)){
                              strAllFilters += ",";
                           }
                        }
                        strAllFilters += "]"; //fechar jogadores equipa1
                     }
                     strAllFilters += "},"; //fechar equipa1
                     
                     strAllFilters += "'equipa2':{'nome': '" + g_arrayFilters[i].Equipa2.name + "','tipo': '" + g_arrayFilters[i].Equipa2.type + "'";
                     
                     if(g_arrayFilters[i].Equipa2.players != undefined){
                        strAllFilters += ",'jogadores': [";
                        for(var j = 0; j < g_arrayFilters[i].Equipa2.players.length; ++j){
                           player = g_arrayFilters[i].Equipa2.players[j];
                           strAllFilters += "{'nome': '" + player.name + "', 'eCanhoto': '" + player.isLeftFoot + "'";
                           if(player.event != undefined){
                              strAllFilters += ", 'ocorrencias': [{";
                              strAllFilters += "'festeja': '" + player.event.celebration + "',";
                              strAllFilters += "'golo': '" + player.event.goal + "',";
                              strAllFilters += "'fazCorte': '" + player.event.tackle + "',";
                              strAllFilters += "'bolaParada': '" + player.event.setPieces + "',";
                              strAllFilters += "'fazFalta': '" + player.event.fault + "',";
                              strAllFilters += "'remate': '" + player.event.shooting + "',";
                              strAllFilters += "'local': '" + player.event.place + "'";
                              strAllFilters += "}]";
                           }
                           strAllFilters += "}"; //fechar 1 jogador
                           if(i != (g_arrayFilters[i].Equipa2.players.length - 1)){
                              strAllFilters += ",";
                           }
                        }
                        strAllFilters += "]"; //fechar jogadores equipa2
                     }
                     strAllFilters += "}}"; //fechar equipa2
                     if(i != (g_arrayFilters.length - 1)){
                        strAllFilters += ",";
                     }
                  }
                  strAllFilters += "]";
                  //alert(strAllFilters);
                  return strAllFilters;
               }
               catch(err){
                  alert("generateFiltersString: " + err.description);
               }
            }
            
            /***********************************/
            /*** View current filter - debug ***/
            /***********************************/
            function viewCurrentFilter(){
               try{
                  var objDivFilter = document.getElementById("viewFilterInfoDiv");
                  if(g_currentFilter == undefined){
                     return;
                  }
                  
                  objDivFilter.innerHTML = "Bola esta: " + g_currentFilter.Location + "<br/>";
                  
                  if(g_currentFilter.Equipa1 != undefined){
                     objDivFilter.innerHTML += "Equipa 1: " + g_currentFilter.Equipa1.name + " - " + g_currentFilter.Equipa1.type + "<br/>";
                  }
                  
                  if(g_currentFilter.Equipa1.players != undefined){
                     for(var i = 0; i < g_currentFilter.Equipa1.players.length; ++i){
                        player = g_currentFilter.Equipa1.players[i];
                        objDivFilter.innerHTML += "...Jogador da Equipa 1: " + player.name + " - " + player.isLeftFoot + "<br/>";
                        if(player.event != undefined){
                           objDivFilter.innerHTML += "......Festejo: " + player.event.celebration + "<br/>";
                           objDivFilter.innerHTML += "......Golo: " + player.event.goal + "<br/>";
                           objDivFilter.innerHTML += "......Desarme: " + player.event.tackle + "<br/>";
                           objDivFilter.innerHTML += "......Bolas Paradas: " + player.event.setPieces + "<br/>";
                           objDivFilter.innerHTML += "......Falta: " + player.event.fault + "<br/>";
                           objDivFilter.innerHTML += "......Remate: " + player.event.shooting + "<br/>";
                           objDivFilter.innerHTML += "......Local: " + player.event.place + "<br/>";
                        }
                     }
                  }
                  
                  if(g_currentFilter.Equipa2 != undefined){
                     objDivFilter.innerHTML += "Equipa 2: " + g_currentFilter.Equipa2.name + " - " + g_currentFilter.Equipa2.type + "<br/>";
                  }
                  
                  if(g_currentFilter.Equipa2.players != undefined){
                     for(var i = 0; i < g_currentFilter.Equipa2.players.length; ++i){
                        player = g_currentFilter.Equipa2.players[i];
                        objDivFilter.innerHTML += "...Jogador da Equipa 1: " + player.name + " - " + player.isLeftFoot + "<br/>";
                        if(player.event != undefined){
                           objDivFilter.innerHTML += "......Festejo: " + player.event.celebration + "<br/>";
                           objDivFilter.innerHTML += "......Golo: " + player.event.goal + "<br/>";
                           objDivFilter.innerHTML += "......Desarme: " + player.event.tackle + "<br/>";
                           objDivFilter.innerHTML += "......Bolas Paradas: " + player.event.setPieces + "<br/>";
                           objDivFilter.innerHTML += "......Falta: " + player.event.fault + "<br/>";
                           objDivFilter.innerHTML += "......Remate: " + player.event.shooting + "<br/>";
                           objDivFilter.innerHTML += "......Local: " + player.event.place + "<br/>";
                        }
                     }
                  }
                  document.getElementById("viewFilterDiv").style.display = '';
               }
               catch(err){
                  alert("viewCurrentFilter: " + err.description);
               }
            }
            
        </script>
    </head>
    <body onload="init()">
        <form id="form1" method="POST">
            <input type="button" value="Ver Filtro Actual" onclick="viewCurrentFilter()">
            <input type="button" value="Ver Filtros Adicionados" onclick="alert(generateFiltersString());">
            <div id="viewFilterDiv" >
               <div id="viewFilterInfoDiv"></div>
               <input type="button" value="close" onclick="document.getElementById('viewFilterDiv').style.display='none';"/>
            </div>
            
            <div id="divMatchFilter">
                <b>Filtros Jogo</b> <br/>
                Equipa 1
                <input type="text" id="Team1Name" name="Team1Name"/>
                <select id="Team1Type" name="Team1Type">
                    <option value="">Nada</option>
                    <option value="EquipaAtacante">Atacante</option>
                    <option value="EquipaDefensora">Defensiva</option>
                </select>
                <br/>
                Equipa 2
                <input type="text" id="Team2Name" name="Team2Name"/>
                <select id="Team2Type" name="Team2Type">
                    <option value="">Nada</option>
                    <option value="EquipaAtacante">Atacante</option>
                    <option value="EquipaDefensora">Defensiva</option>
                </select>
                <br/>
                Zona do campo 
                <select id="BallPlace" name="BallPlace">
                    <option value="">Nada</option>
                    <option value="Area">Area</option>
                    <option value="Baliza">Baliza</option>
                    <option value="LinhaFinal">Linha Final</option>
                    <option value="MeioCampo">Meio Campo</option>
                </select>
                <br/>
                <input id="buttonSaveMatchInfo" type="button" value="Guardar Jogo" onclick="saveMatchInfo()"/>
                <br/>
                <input id="buttonAddPlayerEventFilter" type="button" value="Adicionar Jogador/Ocorrencia" onclick="showPlayerEventFilters()"/>
                <br/>
                <br/>
            </div>
            <div id="divPlayerEventFilter">
                <b>Filtros Jogadores/Ocorrencias</b> <br/>
                <div id="divPlayersList">
                  <ol id="playersList" name="playersList">
                  </ol>
                </div>
                Nome
                <input type="text" id="PlayersName"/>
                Equipa
                <select id="PlayersTeam" name="PlayersTeam">
                    <option value="">Nada</option>
                </select>
                <input type="checkbox" id="cbPlayerLeftFoot" value="LeftFoot" />
                Canhoto
                <br/>
                <input type="checkbox" id="cbPlayerWithEvent" onclick="showHidePlayerWithEvent()" />
                Com ocorrencia
                <br/>
                <div id="divPlayerWithEventFilter">
                   <input type="checkbox" id="cbCelebration" value="Celebration" />
                   Festejo
                   <input type="checkbox" id="cbGoal" value="Goal" />
                   Golo
                   <br/>
                   Corte
                   <select id="Tackle" name="Tackle">
                       <option value="">Nada</option>
                       <option value="Corte">Qualquer</option>
                       <option value="Carrinho">Carrinho</option>
                       <option value="CorteCabeca">Corte de Cabeca</option>
                       <option value="Defesa">Defesa</option>
                       <option value="Desarme">Desarme</option>
                       <option value="Interseccao">Interseccao</option>
                   </select>
                   Bolas Paradas
                   <select id="SetPieces" name="SetPieces">
                       <option value="">Nada</option>
                       <option value="BolaParada">Qualquer</option>
                       <option value="Canto">Canto</option>
                       <option value="Livre">Livre</option>
                       <option value="Penalti">Penalti</option>
                   </select>
                   <br/>
                   Falta
                   <select id="Fault" name="Fault">
                       <option value="">Nada</option>
                       <option value="Falta">Qualquer</option>
                       <option value="Agressao">Agressao</option>
                       <option value="Mao">Mao</option>
                       <option value="Puxao">Puxao</option>
                       <option value="Toque">Toque</option>
                   </select>
                   Remate
                   <select id="Shooting" name="Shooting">
                       <option value="">Nada</option>
                       <option value="Atacante">Qualquer</option>
                       <option value="RemateCabeca">Cabeca</option>
                       <option value="Remate">Pe</option>
                   </select>
                   <br/>
                   Zona do campo 
                   <select id="EventPlace" name="EventPlace">
                       <option value="">Nada</option>
                       <option value="Area">Area</option>
                       <option value="Baliza">Baliza</option>
                       <option value="LinhaFinal">Linha Final</option>
                       <option value="MeioCampo">Meio Campo</option>
                   </select>
                </div>
                <br/>
                <input id="buttonSavePlayerEventInfo" type="button" value="Adicionar" onclick="addPlayerEventInfo()"/>
                <input type="button" value="Limpar Jogadores" onclick="clearPlayersList();"/>
                </br>
                </br>
            </div>
            <div id="divAddFilters">
                <input id="buttonAddFilters" type="button" value="Adicionar Filtro" onclick="addFilters()">
                <input id="buttonCancelMatchInfo" type="button" value="Cancelar" onclick="cancelMatchInfo()"/>
            </div>
            <div id="divSearchSubmit">
               <input type="hidden" id="inputFilters" name="inputFilters" />
               <input id="buttonSubmit" type="button" value="Submeter" onclick="submitForm();">
            </div>
        </form>
    </body>
</html>